<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"
 > 
 <h:head></h:head>
 <body>
 <ui:composition template="/Template/TemplateAdmin.xhtml">
 			<ui:define name="AdminContent">
<p:dataTable var="employee" id="employeeTable" value="#{listEmployeeView.listEmployee}"  paginator="true" rows="15" paginatorPosition="bottom" sortBy="#{employee.codfisc}" >
	<f:facet name="header">
		<h:outputText value="List Employees" />
	</f:facet>
	<p:column headerText="Code" >
		<h:outputText value="#{employee.codfisc}" />
	</p:column>
	<p:column headerText="Name">
		<h:outputText value="#{employee.name}" />
	</p:column>
	<p:column headerText="Surname">
		<h:outputText value="#{employee.surname}" />
	</p:column>
	<p:column headerText="Username">
		<h:outputText value="#{employee.username}" />
	</p:column>
	<p:column headerText="Union Service">
		<ui:fragment rendered="#{employee.association.getClass().getSimpleName()=='Union'}">
		<h:form>
		<p:button value="Add Service" outcome="NewUnionService">
			<f:param name="SendEmployee" value="#{employee.id}"></f:param>
		</p:button>
		</h:form>
				</ui:fragment>
	</p:column>
	
	<p:column headerText="Change data">
		<h:form>
		<p:button value="Edit" outcome="EditEmployee">
			<f:param name="SendEmployee" value="#{employee.id}"></f:param>
		</p:button>
		</h:form>
	</p:column>
	
	<p:column>
		<f:facet name="header">
			<h:form>
				<p:commandButton value="Delete" action="#{listEmployeeView.DeleteEmployee()}" update=":employeeTable" ajax="true"></p:commandButton>
			</h:form>
		</f:facet>
	 <p:selectBooleanCheckbox  >
	 	<p:ajax  listener="#{listEmployeeView.addListDeletedEmployee(employee)}" />
	 </p:selectBooleanCheckbox>
	</p:column>
</p:dataTable>
</ui:define>
</ui:composition>
 </body>
 </html>